/* 
  项目设置
  1. 目前只有设置项目标题, 根据路由的meta元数据进行替换
*/

import { setDocumentTitle } from '@/utils'

const state = {
  title: process.env.VUE_APP_TITLE || ''
}
const mutations = {
  SET_TITLE: (state, title) => {
    state.title = `${title}-${process.env.VUE_APP_TITLE}`
    setDocumentTitle(state.title)
  },
  RESET_TITLE: state => {
    state.title = process.env.VUE_APP_TITLE
    setDocumentTitle(state.title)
  }
}

const actions = {}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
